package com.example.bla;

import java.util.concurrent.ExecutionException;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

public class DrugiActivity extends Activity {
	
	private EditText gameName;
	private EditText playersCount;
	private EditText pointsCount;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.lay1);
		
		gameName = (EditText)findViewById(R.id.gameName);
		playersCount = (EditText)findViewById(R.id.playersCount);
		pointsCount = (EditText)findViewById(R.id.pointsCount);
		
	}
	
	public void onBtnClick(View view)
	{
	
		HttpPostRequest httpPostRequest = new HttpPostRequest();
		httpPostRequest.execute("http://proinz.studentlive.pl/GeoService.svc/CreateGame" , "CreateGame"
				, gameName.getText().toString(), playersCount.getText().toString(), pointsCount.getText().toString());
		
		
        Intent newIntent = new Intent(view.getContext(), MainActivity.class);    
        startActivityForResult(newIntent, 12);
	}
	
	@Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data ) {
           /* Place out code to react on Activity-Result here. */
           super.onActivityResult(requestCode, resultCode, data);
           if(requestCode == 12){
               finish();
           }
    }
}
